<?php
namespace app\test\controller;

use think\Db;

class HandleData
{
    public function companyConvert()
    {
        $result = Db::table('old_company')->field('company_name,longitude,latitude,industry')->select()->toArray();
        $data = [];
        foreach ($result as $k => $v) {
            $data[$k]['name']           = $v['company_name'];
            $data[$k]['longitude']      = $v['longitude'];
            $data[$k]['latitude']       = $v['latitude'];
            $data[$k]['industry_id']    = mt_rand(1, 7);
        }
        Db::table('basic_company')->insertAll($data);
    }
}
